package org.strangewt.demo.composit;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.strangewt.jface.resource.Registries;

public class CompositeRegistries extends Composite {

	private Label lbClass;
	private Label avatar;
	private Label color;
	private Label font;
	
	public CompositeRegistries(Composite parent, int style) {
		super(parent, style);
	
		setLayout(new GridLayout(2, false));
		
		lbClass = new Label(this, SWT.NONE);
		lbClass.setText(getClass().getName());
		GridData gdClass = new GridData();
		gdClass.horizontalSpan = 2;
		lbClass.setLayoutData(gdClass);
		
		Label lbAvatar = new Label(this, SWT.NONE);
		lbAvatar.setText("Image:");
		avatar = new Label(this, SWT.NONE);
		avatar.setImage(Registries.getInstance().getImage("avatar"));
		
		Label lbColor = new Label(this, SWT.NONE);
		lbColor.setText("Color:");
		color = new Label(this, SWT.NONE);
		color.setBackground(Registries.getInstance().getColor("red"));
		color.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		
		Label lbFont = new Label(this, SWT.NONE);
		lbFont.setText("Font:");
		font = new Label(this, SWT.NONE);
		font.setFont(Registries.getInstance().getFont("courier_bold"));
		font.setText("This is courier 10 bold");
	}

}
